//
//  GoodsListTopMenuView.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/23.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class GoodsListTopMenuView: UIView {
    
    
    @IBOutlet weak var leftBtn: UIButton!

    @IBOutlet weak var middleBtn: ImageRightBtn!

    
    @IBOutlet weak var rightBtn: ImageRightBtn!
    
    weak var vc : GoodsListController?
    
    
//    var gc_id : String?
//    var keyword : String?
//    var priceFrom : String?
//    var priceTo : String?
//    var key : String?
//    var order : String?
    
    @IBAction func leftBtnDidTap(_ sender: UIButton) {
        
        middleBtn.isSelected = false
        
        if sender.isSelected == true {
            return
        }

        
       sender.isSelected = true
       
        
        
        
        vc?.requestParameter.priceFrom = nil
        
        vc?.requestParameter.priceTo = nil
        
        vc?.requestParameter.key = "1"
        
        vc?.requestParameter.order = "2"
        
        vc?.loadData()
        
    }
    
    
    
    @IBAction func middleBtnDidTap(_ sender: UIButton) {
        
        leftBtn.isSelected = false
        
        
        if sender.isSelected == false {
            sender.isSelected = true
            vc?.requestParameter.order = "1"
            sender.setImage(UIImage(named: "jshop_price_arrow_up"), for: .selected)

        } else {
            
            if vc?.requestParameter.order == "1" {
                vc?.requestParameter.order = "2"
                sender.setImage(UIImage(named: "jshop_price_arrow_down"), for: .selected)
            } else {
                vc?.requestParameter.order = "1"
                sender.setImage(UIImage(named: "jshop_price_arrow_up"), for: .selected)

            }
        }
        
        
        
        vc?.requestParameter.priceFrom = nil
        
        vc?.requestParameter.priceTo = nil
        
        vc?.requestParameter.key = "2"
        
        
        vc?.loadData()


        
    }
    
    
    
    @IBAction func rightBtnDidTap(_ sender: UIButton) {
        
        
        
    }
    

}
